package com.tbm.console.proj.json;

import com.tbm.console.base.controller.BaseController;
import com.tbm.console.proj.entity.TemplatePage;
import com.tbm.console.proj.service.TemplatePageService;
import com.tbm.console.util.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class TemplatePageJson extends BaseController {

    @Autowired
    private TemplatePageService templatePageService;

    /**
     * 显示list
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "/templatePage-list/{page}/{size}")
    public Map<String,Object> templatePageList(@PathVariable("page") Integer page, @PathVariable("size") Integer size){
        PageData pageData = this.getPageData();
        pageData.put("deleteFlag", "N");
        long count = templatePageService.count(pageData);
        List<TemplatePage> templatePages = templatePageService.findAll(pageData,page-1,size);
        pageData.put("total",count);
        pageData.put("rows", templatePages);
        return pageData;
    }

}
